import time

import allure
from selenium.webdriver.common.by import By
from pytest00.tpshop.util import Driver
#driver.find_element(By.CSS_SELECTOR, '[]').send_keys("")
#driver.find_element(By.CSS_SELECTOR, '[]').click()
class Home:
    @classmethod
    @allure.step("点击前台登录")
    def click_login(self):
        driver = Driver.get_driver()
        driver.find_element(By.CSS_SELECTOR, '[class="fl nologin"] [class="red"]').click()
    @classmethod
    @allure.step("点击前台注册")
    def click_zhuce(self):
        driver = Driver.get_driver()
        driver.find_element(By.CSS_SELECTOR, '[href="/Home/user/reg.html"]').click()
class Login:
    @allure.step("调用前台登录")
    def login(self,count,pss):
        driver=Driver.get_driver()
        driver.find_element(By.CSS_SELECTOR, '[placeholder="手机号/邮箱"]').send_keys(count)
        driver.find_element(By.CSS_SELECTOR, '[id="password"]').send_keys(pss)
        driver.find_element(By.CSS_SELECTOR, '[id="verify_code"]').send_keys("8888")
        allure.attach(driver.get_screenshot_as_png(), "前台登录截图", allure.attachment_type.PNG)
        driver.find_element(By.CSS_SELECTOR, '[name="sbtbutton"]').click()


class Zhuce:
    @allure.step("调用前台注册")
    def zhuce(self,count,passs):
        driver=Driver.get_driver()
        driver.find_element(By.CSS_SELECTOR, '[id="username"]').send_keys(count)
        driver.find_element(By.CSS_SELECTOR, '[placeholder="图像验证码"]').send_keys("8888")
        driver.find_element(By.CSS_SELECTOR, '[class="inp fpass J_password"]').send_keys(passs)
        driver.find_element(By.CSS_SELECTOR, '[class="inp fsecpass J_password2"]').send_keys(passs)
        driver.find_element(By.CSS_SELECTOR, '[name="invite"]').send_keys("16620879439")
        driver.find_element(By.CSS_SELECTOR, '[onclick="check_submit();"]').click()
        allure.attach(driver.get_screenshot_as_png(), "前台登录注册截图", allure.attachment_type.PNG)
















